package queue

import "github.com/pkg/errors"

var QueueEmptyErr = errors.New("empty")

type Queue struct {
	Data []interface{}
}

func (q *Queue) Push(num interface{}) {
	q.Data = append(q.Data, num)
}

func (q *Queue) Pop() (interface{}, error) {
	if len(q.Data) == 0 {
		return 0, QueueEmptyErr
	}
	popNum := q.Data[0]
	q.Data = q.Data[1:]
	return popNum, nil
}

func (q *Queue) IsEmpty() bool {
	if len(q.Data) == 0 {
		return true
	} else {
		return false
	}
}

func NewQueue() *Queue {
	return &Queue{}
}
